<?php
class IdentController extends Zend_Controller_Action
{
 public function identAction()
    {
     echo "connect"; // comm version 1
     
    }
 public function connectidentAction() {
 	$form = new Form_Connectident();
 	if ($this->getRequest()->isPost()){ //si posté
    	 if ($this->getRequest()->getPost("Valider")) { // si premier formulaire        	
     
           	if ($form->isValid($this->getRequest()->getPost())) {// si valeurs recup
           		$valeurs=$this->getRequest()->getPost();   
               	 $tableP = new Table_Personnes();
               	 $resu=$tableP->verifLogin($valeurs["login"],$valeurs["pwd"]);

               	 if ($resu!='nok'){               	 	
               	 	$_SESSION["login"]=$valeurs["login"];
               		$_SESSION["id"]=$resu;
           
               		$this->_redirect('/');                	 	
               	 }
               	 else {
               	 	$this->view->connectident=$resu; // version 2
               	 }
               	 
           	} //fin valeurs recup
    	 }//fin si clique bouton Valider
 	}// fin formulaire posté
 	$this->view->form = $form;
 } 
 public function deconnectidentAction() {
  	unset($_SESSION['login']);
  	unset($_SESSION['id']);
 }	
 
}
